<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<title>个人信息-耶回收官网</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="renderer" content="webkit" />
<link href="<%=basePath%>static/css/common_new.min.css" rel="Stylesheet"
	type="text/css" />
<link href="<%=basePath%>static/css/index.min.css" rel="stylesheet" />
<link rel="stylesheet" href="<%=basePath%>static/css/style.css">
<link rel="stylesheet" href="<%=basePath%>static/css/info.css">
<link rel="stylesheet" href="<%=basePath%>css/zupin01.css">
<script type="text/javascript" src="<%=basePath%>js/kefu.js"></script>
</head>
<body class="   ">
	<div id="header" class=" noscroll fixedTop ">

		<div class="navbar">
			<div class="navbar-content">
				
			</div>
		</div>
		<div class="top-area">
			<div class="search">
				<a class="logo-link" href="<%=basePath%>"
					title="耶回收网,手机回收,笔记本回收,减法新生活,中国专业可靠的二手数码回收平台"> <span
					class="icon-logo" style="width: 220px;"></span>
				</a> 
				<!-- <a href="/" class="backup" title="东方风云榜，音乐盛典独家冠名">
                    <img src="static/picture/fengyunbang.png">
                </a> -->
				
			</div>

			<div class="nav-projects">
				<div class="tab-menu">
					<ul class="clearfix">
						<li><a href="<%=basePath%>" 
							class="activemenu first-tab" title="手机回收,二手手机回收,专业靠谱的数码产品回收平台">
								旧机回收 <i></i>
						</a></li>

						<li class="erCode"><a href="http://www.yehuishou.com"
							class="special" title="耶回收公众号"> 耶回收公众号 <!-- <i></i> --> <span
								class='tip'>福利</span> <span class="jiantou"></span>
						</a>
							<div class="ahsCont">
								<img src="img/gzh_20180709145607.jpg" alt="耶回收公众号" />
								<p>
									扫码关注公众号 <br /> <span>领新人加价礼包</span>
								</p>
							</div></li>
						<li class="dis welfare"><a
							href="<%=basePath%>sellindex"
							title="耶优品 ，低价好物" >耶优品 <i></i>
						</a></li>
						<li class="dis welfare"><a
							href="<%=basePath%>leaseitem" title="低价租赁" >低价租赁
								<i></i>
						</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>



	<div id="body" style="margin-top: 80px;">

		<div class="progressbar">
			<div class="currentProgress">
				<span></span>
			</div>
		</div>

		<div class="breadcrumb-navs">
			<ul class="nav">
				<li><a href="<%=basePath%>">首页</a></li>
				<li><a href="#">个人中心</a></li>

			</ul>

		</div>

		<!-- 这里写 -->
		<div id="group-property" class="clearfix"
			data-sku-property-value-ids='[["2014","2023","2072","2453","6437"],["2014","2072","2453","3987","6437"],["2015","2023","2072","2453","6437"],["2015","2072","2453","3987","6437"],["2019","2023","2072","2453","6437"],["2019","2072","2453","3987","6437"],["2023","2072","2453","2794","6437"],["2072","2453","2794","3987","6437"],["2023","2072","2453","2984","6437"],["2072","2453","2984","3987","6437"],["2014","2023","2072","2454","6437"],["2014","2072","2454","3987","6437"],["2015","2023","2072","2454","6437"],["2015","2072","2454","3987","6437"],["2019","2023","2072","2454","6437"],["2019","2072","2454","3987","6437"],["2023","2072","2454","2794","6437"],["2072","2454","2794","3987","6437"],["2023","2072","2454","2984","6437"],["2072","2454","2984","3987","6437"],["2014","2023","2075","2453","6437"],["2014","2075","2453","3987","6437"],["2015","2023","2075","2453","6437"],["2015","2075","2453","3987","6437"],["2019","2023","2075","2453","6437"],["2019","2075","2453","3987","6437"],["2023","2075","2453","2794","6437"],["2075","2453","2794","3987","6437"],["2023","2075","2453","2984","6437"],["2075","2453","2984","3987","6437"],["2014","2023","2075","2454","6437"],["2014","2075","2454","3987","6437"],["2015","2023","2075","2454","6437"],["2015","2075","2454","3987","6437"],["2019","2023","2075","2454","6437"],["2019","2075","2454","3987","6437"],["2023","2075","2454","2794","6437"],["2075","2454","2794","3987","6437"],["2023","2075","2454","2984","6437"],["2075","2454","2984","3987","6437"],["2014","2023","2072","2453","6438"],["2014","2023","2075","2453","6438"],["2014","2072","2453","3987","6438"],["2014","2075","2453","3987","6438"],["2015","2023","2072","2453","6438"],["2015","2023","2075","2453","6438"],["2015","2072","2453","3987","6438"],["2015","2075","2453","3987","6438"],["2019","2023","2072","2453","6438"],["2019","2023","2075","2453","6438"],["2019","2072","2453","3987","6438"],["2019","2075","2453","3987","6438"],["2023","2072","2453","2794","6438"],["2023","2075","2453","2794","6438"],["2072","2453","2794","3987","6438"],["2075","2453","2794","3987","6438"],["2023","2072","2453","2984","6438"],["2023","2075","2453","2984","6438"],["2072","2453","2984","3987","6438"],["2075","2453","2984","3987","6438"],["2023","2072","2453","3950","6438"],["2023","2075","2453","3950","6438"],["2072","2453","3950","3987","6438"],["2075","2453","3950","3987","6438"],["2014","2023","2072","2454","6438"],["2014","2023","2075","2454","6438"],["2014","2072","2454","3987","6438"],["2014","2075","2454","3987","6438"],["2015","2023","2072","2454","6438"],["2015","2023","2075","2454","6438"],["2015","2072","2454","3987","6438"],["2015","2075","2454","3987","6438"],["2019","2023","2072","2454","6438"],["2019","2023","2075","2454","6438"],["2019","2072","2454","3987","6438"],["2019","2075","2454","3987","6438"],["2023","2072","2454","2794","6438"],["2023","2075","2454","2794","6438"],["2072","2454","2794","3987","6438"],["2075","2454","2794","3987","6438"],["2023","2072","2454","2984","6438"],["2023","2075","2454","2984","6438"],["2072","2454","2984","3987","6438"],["2075","2454","2984","3987","6438"],["2023","2072","2454","3950","6438"],["2023","2075","2454","3950","6438"],["2072","2454","3950","3987","6438"],["2075","2454","3950","3987","6438"]]'>
			<div class="left">
				<ul class="clearfix section-price" id="qianbao"
					data-highest-price="7145" style="height: 400px;">
					<p class="section-price-title price-title-2"
						style="margin-top: 80px;">个人中心</p>
					<a href="#">个人信息</a><br/>
					<a href="<%=basePath%>order" style="color: black;">订单中心</a>
					
				</ul>

			</div>
			<div class="right">
				<div class="body-main-box">
					<div class="userinfo">
						<p class="us-title">个人信息</p>
						<div class="us-avatar" id="userAvater">
							<!-- 用背景图片还是img自便 -->
						</div>
						<div class="us-greeting">
							<p class="us-mobile">${user.phone }</p>
							<p class="greeting">您好！</p>
						</div>
					</div>
					<div class="widget-userinfo-card">
						<div class="card card-nameindenity">
							<div class="card-title">
								个人身份认证 <span class="highlight"> <c:if test="${k != 2 }">
										暂未认证
									</c:if> <c:if test="${k == 2 }">
										<c:if test="${istate == 1 }">
											审核中
										</c:if>
										<c:if test="${istate == 2 }">
											审核通过
										</c:if>
										<c:if test="${istate == 3 }">
											审核失败
										</c:if>
									</c:if>
								</span>
								<div class="card-content">
									<a class="btn-default bomb-btn" href="#"
										data-type="nameindenity">立即认证</a>
								</div>
							</div>
							<div class="card-desc">实名认证，提升个人账户安全</div>
						</div>
						<div class="card card-enterprise">
							<div class="card-title">
								企业认证 <span class="highlight"> <c:if test="${k != 1 }">
										暂未认证
									</c:if> <c:if test="${k == 1 }">
										<c:if test="${istate == 1 }">
											审核中
										</c:if>
										<c:if test="${istate == 2 }">
											审核通过
										</c:if>
										<c:if test="${istate == 3 }">
											审核失败
										</c:if>
									</c:if>
								</span>
								<div class="card-content">
									<a class="btn-default bomb-btn" href="#" data-type="enterprise">立即认证</a>
								</div>
							</div>
							<div class="card-desc">企业认证，产权账户安全</div>
						</div>
						<div class="card card-mobile">
							<div class="card-title">
								手机号 <span class="highlight">已绑定</span> <span>(${user.phone })</span>
							</div>
							<div class="card-desc">手机号用于登录账号，重置密码或其它安全验证</div>
							<div class="card-content">
								<a class="btn-default bomb-btn" href="#" data-type="mobile">更换</a>
							</div>
						</div>
						<div class="card card-address">
							<div class="card-title">
								收货地址 <span class="highlight">${a==1?"已填写":"未填写" }</span>
							</div>
							<div class="card-desc">用于收取货物，以及寄回等</div>
							<div class="card-content">
								<a id="address" class="btn-default bomb-btn" href="#"
									data-type="address">填写</a>
							</div>
						</div>
						<div class="card card-loginpasswd">
							<div class="card-title">登录密码</div>
							<div class="card-desc">用于保护账号信息和登录安全</div>
							<div class="card-content">
								<a class="btn-default bomb-btn" href="#" data-type="loginpasswd">更换</a>
							</div>
						</div>
						<div class="card card-loginpasswd">
							<div class="card-title">收款码</div>
							<div class="card-desc">用于回收商品收款二维码</div>
							<div class="card-content">
								<a class="btn-default bomb-btn" href="#" data-type="erwm">更换</a>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="bomb-box" id="bombBox" style="display: none;">
				<div class="bomb-window">
					<div class="bind-form bind-identity-card" style="display: none;"
						data-type="nameindenity" data-name="个人身份认证">
						<form action="shenfen" method="post" enctype="multipart/form-data" onsubmit="return shenfen(this)">
						<input style="display: none;" name="id" value="${user.uid}">
							<div class="user-name">
								<label for="userName">真实姓名（身份证上的姓名，绑定后不可修改）</label> <input
									type="text" name="name" id="userName"
									placeholder="身份证上的姓名，绑定后不可修改">
							</div>
							<div class="user-id">
								<label for="userId">身份证件号</label> <input type="text"
									name="certificate" id="userId" maxlength="18"
									placeholder="真实身份证号，绑定后不可修改">
							</div>
							<div class="user-id">
								<label for="fileImageFace">身份证正面</label> 
								<input type="file" id="fileImageFace" name="filez" value="请上传图片" /> 
								<label for="fileImageBack">身份证背面</label> 
								<input type="file" id="fileImageBack" name="fileb" value="请上传图片" />
								<label for="fileImageBack">学生证(选填)</label> 
								<input type="file" id="fileImagexue" name="filex" value="请上传图片" />
							</div>
							<button type="submit" class="btn-next">确定</button>
							<button type="button" class="btn-next" onclick="fh(this)">返回</button>
						</form>
					</div>
					
					<div class="bind-form bind-enterorise" style="display: none;"
						data-type="enterprise">
						<form action="qiye" method="post" enctype="multipart/form-data"
							data-name="企业认证" onsubmit="return qiye(this)">
							<input style="display: none;" name="id" value="${user.uid}">
							<div class="user-name">
								<label for="qiyename">企业注册名</label> <input type="text"
									name="name" id="qiyename" placeholder="注册企业名，与证件一致">
							</div>
							<div class="user-name">
								<label for="qiyecertificate">企业注册号</label> <input type="text"
									name="certificate" id="qiyecertificate"
									placeholder="注册企业号，与证件一致">
							</div>
							<div class="user-id">
								<label for="qiyeimage">企业证件</label> <input type="file"
									id="qiyeimage" name="file" value="请上传图片" />
							</div>
							<button type="submit" class="btn-next">确认</button>
							<button type="button" class="btn-next" onclick="fh(this)">返回</button>
						</form>
					</div>
					
					<div class="bind-form bind-address" style="display: none;"
						data-type="address">
						<form action="saddress" method="post"
							enctype="multipart/form-data" data-name="企业认证" onsubmit="return dz(this)">
							<input style="display: none;" name="uid" value="${user.uid}">
							<label for="address">省/市/区</label> 
							<select class="demo" id="province" onchange="getCity()" name="state">
								<option>
								<c:if test="${addr.state==null || addr.state==''}">请选择</c:if>
								<c:if test="${addr.state!=null && addr.state!=''}">${addr.state}</c:if>
								</option>
							</select> 
							<select class="demo" id="city" onchange="getDown()" name="city">
								<option>
								<c:if test="${addr.city==null || addr.city==''}">请选择</c:if>
								<c:if test="${addr.city!=null && addr.city!=''}">${addr.city}</c:if>
								</option>
							</select> 
							<select class="demo" id="area" name="district">
								<option>
								<c:if test="${addr.district==null || addr.district==''}">请选择</c:if>
								<c:if test="${addr.district!=null && addr.district!=''}">${addr.district}</c:if>
								</option>
							</select>
							<div class="user-name">
								<label for="address">收货地址</label> 
								<input type="text" name="address" id="address" placeholder="填写有效的详细地址" value="${addr.address}">
							</div>
							<button type="submit" class="btn-next">确认</button>
							<button type="button" class="btn-next" onclick="fh(this)">返回</button>
						</form>
					</div>
					
					<div class="bind-form bind-mobile" style="display: none;"
						data-type="mobile">
						<div class="user-mobile">
							<label for="moblieNumber">手机号</label> <input type="text"
								class="textInput-mobile" name="moblieNumber" maxlength="11"
								id="phone" placeholder="请输入您的手机号"> <input type="button"
								id="btn-get-smscode" class="btn-get-smscode"
								onclick="settime(this)" value="获取验证码"></input>
						</div>
						<div class="user-id">
							<label for="userId">短信验证码</label> <input type="text" id="coud"
								placeholder="请输入收到的短信验证码">
						</div>
						<button type="button" class="btn-next"
							onclick="phone(${user.uid})">确定</button>
						<button type="button" class="btn-next" onclick="fh(this)">返回</button>
					</div>

					<div class="bind-form bind-loginpasswd" style="display: none;"
						data-type="loginpasswd">
						<div class="user-mobile">
							<label for="moblieNumber">密码</label> <input type="text"
								id="password" placeholder="请输入密码">
						</div>
						<div class="user-id">
							<label for="userId">确认密码</label> <input type="text"
								id="qpassword" placeholder="请输入密码">
						</div>
						<button type="button" class="btn-next"
							onclick="password(${user.uid})">确定</button>
						<button type="button" class="btn-next" onclick="fh(this)">返回</button>
					</div>
					
					<div class="bind-form bind-erwm" style="display: none;"
						data-type="erwm">
						<form action="erwm" method="post" enctype="multipart/form-data"
							data-name="二维码" >
							<input style="display: none;" name="uid" value="${user.uid}">
							<div class="user-id">
								<label for="qiyeimage">二维码</label> 
								<input type="file" id="qiyeimage" name="file" value="请上传图片" onchange="xianstp(this)"/>
							</div>
							<div class="user-id" id="tp" style="width: 200px; height: 250px; border: solid 1px lightGray">
								<img src="${erwm }" style="width: 200px;height: 250px;">
							</div>
							<button type="submit" class="btn-next">确认</button>
							<button type="button" class="btn-next" onclick="fh(this)">返回</button>
						</form>
					</div>
				</div>
			</div>
		</div>
		<!-- 结束 -->
		<!-- 底部 -->
    <section>
        <jsp:include page="bottom.jsp" />
    </section>

		<%-- <script src="<%=basePath%>static/js/index.js"></script> --%>
		<script src='<%=basePath%>static/js/info.js'></script>
		<script type="text/javascript" src="<%=basePath%>js/jquery-1.11.1.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>static/js/jquery.min.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>static/layer/2.4/layer.js"></script>

		<script type="text/javascript" src="js/province.js"></script>
		<script type="text/javascript">
		/* function xianstp() {
            //图片显示插件
            $.imageFileVisible({ wrapSelector: "#tp",
                fileSelector: "#qiyeimage",
                width: 300,
                height: 300
           });
        }; */
        
		function xianstp(obj) {
        	
			var file = obj.files[0];
            var imageType = /image.*/;
            if (file.type.match(imageType)) {
                var reader = new FileReader();
                reader.onload = function () {
                    var img = new Image();
                    img.src = reader.result;
                    
                    $(img).width(200);
                    $(img).height(250);
                    //清空
                   // $(opts.wrapSelector).empty();
                   
                   //判断是否是上传一张  还是多张
                   	$("#tp").empty();
                    $("#tp").append(img);
                };
                reader.readAsDataURL(file);
            } else {
                alert("");
            }
		};
		
		
         
		
var province = p.province;
$(function(){
	 $("#address").click(function(){
		 setTimeout(function(){
			 for(var i=0; i<province.length;i++){
					$("#province").append("<option>"+province[i].name+"</option>");
				} 
		 },1000);
			
	 });
});
//省份值改变事件
function getCity(){
	//获取省份
	var s =$("#province").val();
	$("#city").empty();
	$("#area").empty();
	$("#city").append("<option>请选择</option>");
	$("#area").append("<option>请选择</option>");
	//获取省份下所有的市县
	 for(var i=0; i<province.length;i++){
		 if(s==province[i].name){
			 for(var j=0; j<province[i].city.length;j++){
				 $("#city").append("<option>"+province[i].city[j].name+"</option>"); 
			 } 
			 
		 }
		
		} 
	
	
}


function getDown(){
	//获取省份
	$("#area").empty();
	//$("#area").append("<option>请选择</option>");
	var s =$("#province").val();
	var c =$("#city").val();
	//获取省份下所有的市县
	 for(var i=0; i<province.length;i++){
		 if(s==province[i].name){
			 for(var j=0; j<province[i].city.length;j++){
				if(c==province[i].city[j].name){
					 for(var k=0; k<province[i].city[j].area.length;k++){
						 $("#area").append("<option>"+province[i].city[j].area[k]+"</option>");  
					 }
					
				}
				 
				
			 } 
			 
		 }
		
		} 
	
	
}

//发送验证码
var countdown=60;
function settime(obj) {
	var phone=$("#phone").val();
	if( phone!=null &&phone!=""){
		$.post("phone",{phone:phone},function(data){
			if(data){
				$.post("send",{phone:phone},function(data){
					if(data.msg=="success"){
						time(obj);
					}
				},"json");
			}else{
				layer.msg("手机号已存在",{icon: 2,time:2000});
			}
		},"json");
	}
	function time(obj){
	    if (countdown == 0) {
	        obj.removeAttribute("disabled");   
	        obj.value="获取验证码";
	        countdown = 60;
	        return;
	    } else {
	        obj.setAttribute("disabled", true);
	        obj.value="重新发送(" + countdown + ")";
	        countdown--;
	    }
	setTimeout(function() {
	    time(obj) }
	    ,1000)
	}
};

//修改密码
function password(uid){
	var password=$("#password").val();
	var qpassword=$("#qpassword").val();
	if(password!="" && password!=null && qpassword!="" && qpassword!=null ){
		if(password != qpassword){
			layer.msg("两次密码不相同",{icon: 2,time:2000});
			return;
		};
		$.post("updateu",{password:password ,uid:uid },function(data){
			if(data){
				window.location.reload();
			}
		},"json");
		return;
	};
	layer.msg("密码不能为空",{icon: 2,time:2000});
	return;
};
//修改手机
function phone(uid){
	var phone=$("#phone").val();
	var coud=$("#coud").val();
	if(coud!="" && coud!= null){
		$.post("updateu",{phone:phone ,coud:coud ,uid:uid },function(data){
			if(data){
				window.location.reload();
			}else{
				layer.msg("验证码错误",{icon: 2,time:2000});
			}
		},"json");
		return;
	}
	layer.msg("验证码不能为空",{icon: 2,time:2000});
};
//验证企业
function qiye(obj){
	if(obj.name.value=='' || obj.name.value==null){
		layer.msg("企业注册名不能为空",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.certificate.value=='' || obj.certificate.value==null){
		layer.msg("企业注册号不能为空",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.file.value=='' || obj.file.value==null){
		layer.msg("图片不能为空",{icon: 2,time:2000});
		return false;
	}
	
	return true;
};
//个人身份验证
function shenfen(obj){
	if(obj.name.value=='' || obj.name.value==null){
		layer.msg("姓名名不能为空",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.certificate.value=='' || obj.certificate.value==null){
		layer.msg("身份证号不能为空",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.filez.value=='' || obj.filez.value==null){
		layer.msg("图片不能为空",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.fileb.value=='' || obj.fileb.value==null){
		layer.msg("图片不能为空",{icon: 2,time:2000});
		return false;
	}
	return true;
};
//地址
function dz(obj){
	if(obj.state.value=='请选择'){
		layer.msg("请选择省",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.city.value=='请选择'){
		layer.msg("请选择市",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.district.value=='请选择'){
		layer.msg("请选择区",{icon: 2,time:2000});
		return false;
	}
	
	if(obj.address.value=='' || obj.address.value==null){
		layer.msg("详细地址不能为空",{icon: 2,time:2000});
		return false;
	}
	return true;
};

function fh(obj){

	$(obj).parents(".bind-form").css("display","none");
	$("#bombBox").css("display","none");
}
</script>
</body>

</html>